from flask import jsonify


def re_response(code = 2000,msg = "操作成功",data = None,token = None,**kwargs):
    if token:
        return jsonify(
            {
                "code": code,
                "msg": msg,
                "data": data,
                "token": token
            }
        )
    elif data:
        return jsonify(
            {
                "code": code,
                "msg": msg,
                "data": data,
            }
        )
    elif kwargs:
        return jsonify(
            {
                "code": code,
                "msg": msg,
                "data": kwargs,
            }
        )
    return jsonify(
        {
            "code": code,
            "msg": msg
        }
    )